// 平台属性管理相关API

// 引入二次封装的axios
import request from '@/utils/request'

//获取一级分类ID  /admin/product/getCategory1  get  无参
export const reqGetCategory1=()=>{
    return request.get(`/admin/product/getCategory1`)
} 

// 获取二级分类ID  /admin/product/getCategory2/{category1Id}   get 参数：category1Id
export const reqGetCategory2 =function (category1Id) { 
    return request.get(`/admin/product/getCategory2/${category1Id}`)
}

// 获取三级分类ID  /admin/product/getCategory3/{category2Id}   get 参数：category2Id
export const reqGetCategory3=(category2Id)=>request.get(`/admin/product/getCategory3/${category2Id}`)


//获取平台属性接口
// /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id} get 参数：一二三级ID
export const reqAttrList=(category1Id,category2Id,category3Id)=>request.get(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)


// 添加属性与属性值
// /admin/product/saveAttrInfo post 
/*参数：
{
  "attrName": "",      属性名
  "attrValueList": [   属性名中属性值，因为属性值可以是多个，因此需要的是数组
    {
      "attrId": 0,          属性的id
      "valueName": "string"  属性值
    }
  ],
  "categoryId": 0,    category3Id
  "categoryLevel":3,
}
*/
export const reqAddOrUpdateAttr=(data)=>request.post(`/admin/product/saveAttrInfo`,data)
